<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <!-- metas -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- css -->
    <link rel="stylesheet" type="text/css" href="<?=BASEURL.CSS_DIR?>reset.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="<?=BASEURL.CSS_DIR?>admin/common.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="<?=BASEURL.CSS_DIR?>admin/popin.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="<?=BASEURL.CSS_DIR?>admin/style_edit.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="<?=BASEURL.CSS_DIR?>admin/header.css" media="screen"/>
    <!-- javascript -->
    <?=$js_header?>
    <title>Nimwiki :: editing :: <?=$pagename?></title>
  </head>
  <body>
<!-- start div page -->
<div id="page" >

    <!-- start div header -->
    <?=$div_header?>
    <!-- end div header -->
   
    
    <!-- start div content -->
    <div id="content" >
   
    <!--  start div submenu -->
    <div id=submenu >
    <a href="<?=site_url("/admin/wikimgr/listpages");?>" >« back to page manager</a>
    </div>
    <!--  end div submenu -->
   
   
   
    <h1 class="action">Editing page : <?=$pagename?></h1>
   
    <!-- start div barre -->
    <div id="actionbar" >
        <div>
           <div>
           		<a href="#" id="btVersions" class="button" >Revisions</a>
           		<a href="#" id="btTemplate" class="button" >Choose template</a>
           		<a href="#" id="btTags" class="button" >Edit tags</a>
                <a href="#" id="btCreatePage" class="button" >New page</a>
                <? if ($this->user->isAuthorized("/admin/delete", $pagename)): ?>
                <a href="#" id="btDeletePage" class="button" >Delete page</a>
                <? endif; ?>
                
            </div>
        </div>
        <div style="float:right">
            <a href="javascript:document.myForm.submit();" class="button" >Save</a>
            <a href="<?=site_url('/wiki/read/'.$pagename)?>" class="button"  >Cancel</a>
            <a href="#" id="btHelp" class="button" style="margin-right:0;">Help</a>
        </div>
    </div>
    <!-- end div barre1 -->
    
    <!-- start div edit -->
    <div id="edit">
        <form name="myForm" method="post" action="<?=site_url("/admin/wikimgr/save/$pagename")?>">
        <textarea name="content" id="textarea1" ><?=$content?></textarea><div id="footer" ><!--last modified -->
          
        <input type="hidden" name="meta[lastauthor]" value="<?=$this->wiki_model->readMeta($pagename,"author")?>" />
        <input type="hidden" id="frmTemplate" name="meta[template]" value="<?=$this->wiki_model->readMeta($pagename,"template")?>" />
        <input type="hidden" id="frmTags" name="meta[tags]" value="<?=$this->wiki_model->readMeta($pagename,"tags")?>" />
        
        
        </div>
        </form> 
    </div>
    <!-- end div edit -->

    </div>
    <!-- end div content --> 
    
</div>
<!-- end div page --> 

<!-- popup links -->
<div id="pop_editlink" style="display:none;">
	<fieldset>
	<label><strong>Text to display</strong></label>
	<div class="left" ><input type="text" value="description" id="texttodisplay" class="left large" /></div>
	</fieldset>
	<fieldset>
	<div class="separ select" >
		<label><input type="radio" name="group1" value="wikipage" checked >&nbsp;&nbsp;Wiki page</label>
	    <select id="wikipage" name="selectPage" class="left large">
	      <?foreach ($this->wiki_model->getAllPages() as $page):?>
	        <option value ="<?=$page?>" class="large" ><?=$page?></option>
	      <?endforeach;?>
	    </select>
	</div>
	<div class="separ" >    
		<label><input type="radio" name="group1" value="webadress" />&nbsp;&nbsp;Web adress</label>
		<input type="text" value="http://" id="webadress" class="left large" />
	</div>
	<div class="separ">   
		<label><input type="radio" name="group1" value="email" />&nbsp;&nbsp;Email adress</label>
		<input type="text" value="name@" id="emailadress" class="left large" />
	</div>
	</fieldset>
	<fieldset>
	<div >
		<input type="checkbox" value="blank" class="left" style="clear:left;margin:3px;"/><div class="left" >Open in a blank page</div>
	</div>
	</fieldset>
	<fieldset class="fieldbuttons" >
		<a href="#" onclick="insertLinkInCode();closePopIn();" class="button right" >Insérer</a>
		<a href="#" onclick="closePopIn();" class="button right" >Annuler</a>
	</fieldset>
	</div>
</div>
<!-- end popup links -->

<!-- start popup block -->
<div id="pop_addbloc" style="display:none;" >
	<fieldset>
	            <label>Choose a bloc:</label>
            <select id="selectBloc" class="left large" style="width:150px;" onchange="$('#popInContent #descr').html(this.options[this.selectedIndex].title)">
                <?foreach($blocs as $blocname=>$bloc):?>
                <option value="<?=$blocname?>" title="<?=$bloc["desc_en"]?>" ><?=$blocname?></option>
                <?endforeach;?>
            </select>
	</fieldset>
	<fieldset><label>Description:</label>
		<div id="descr" style="height:80px;overflow:auto;" >Choose a bloc in the list above to get the description...</div>
	</fieldset>
	<fieldset class="fieldbuttons" >
		<a href="#" onclick="insertBlocInCode();closePopIn();" class="button right" >Insert bloc</a>
		<a href="#" onclick="closePopIn();" class="button right" >Cancel</a>
	</fieldset>
</div>
<!-- end popup block -->

<!-- start popup versions -->
<div id="pop_versions" style="display:none;" >
<fieldset>
        <div>
            <label>Choose a revision:</label><br />
            <select id="selectVersion" class="left large" >
                <?foreach($versions as $version):?>
                <option value="<?=$version["name"]?>" <?=($version["name"]==$pagename) ? 'selected="selected"' : '';?>><?=$version["date"]?></option>
                <?endforeach;?>
            </select>
        </div>
</fieldset>
	<fieldset class="fieldbuttons" >
		<a href="#" onclick="gotoVersion();" class="button right" >Choose</a>
		<a href="#" onclick="closePopIn();" class="button right" >Annuler</a>
	</fieldset>
</div>
<!-- end popup versions -->

<!-- start popup template -->
<div id="pop_template" style="display:none;" >
	<fieldset>
	            <label>Choose a template:</label>
            <select id="selectTemplate" name="meta[template]" class="left large" style="width:150px;" onchange="$('#popInContent #descr').html(this.options[this.selectedIndex].title)">
                <?foreach($templates as $templateKey=>$template):?>
                <option value="<?=$templateKey?>" <?=($templateKey==getmeta($pagename,'template')) ? 'selected="selected"' : '';?>><?=$template[0]?></option>                
                <?endforeach;?>
            </select>
	</fieldset>
	<fieldset><label>Description:</label>
		<div id="descr" style="height:80px;overflow:auto;" >Choose a bloc in the list above to get the description...</div>
	</fieldset>
	<fieldset class="fieldbuttons" >
		<a href="#" onclick="changeTemplate();closePopIn();" class="button right" >Choose template</a>
		<a href="#" onclick="closePopIn();" class="button right" >Cancel</a>
	</fieldset>
</div>
<!-- end popup template -->

<!-- start popup tags -->
<div id="pop_tags" style="display:none;" >
<fieldset>
        <div>
            Tags:<br />
            <textarea id="editTags" style="width:99%;height:100px;margin-top:5px"></textarea>
        </div>
</fieldset>
	<fieldset class="fieldbuttons" >
		<a href="#" onclick="updateTags();closePopIn();" class="button right" >Ok</a>
		<a href="#" onclick="closePopIn();" class="button right" >Cancel</a>
	</fieldset>
</div>
<!-- end popup tags -->

</body>
</html>